home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / text0147.txt < prev    next >
Encoding:
Text File  |  1998-04-01  |  1.4 KB  |  44 lines

  1. > I  was  wondering if anyone knows how to copy a bob from a
  2. > sprite bank to a new position in a sprite bank?
  3. > (I know how to do this and how to get it in the correct position using
  4. > the Del Bob and Ins Bob commands)
  5. > Surely there must be a simple command to copy one bob over
  6. > another?
  7.  
  8.    Hmmm... don't know of any actual AMOS command that does this,
  9.    but then again I'm not very familiar with AMOS Pro.
  10.  
  11.    For a "quick and easy" solution, I'd just use the method you
  12.    mentioned above, wrap it up in a procedure and you have your
  13.    own custom command:
  14.  
  15.    Procedure CLONE_BOB[SOURCEIMAGE,DESTIMAGE]
  16.      CURRENTSCREEN=Screen
  17.      IMGSTRUCT=Sprite Base(SOURCEIMAGE)
  18.      IMGWIDTH=Deek(IMGSTRUCT)*16
  19.      IMGHEIGHT=Deek(IMGSTRUCT+2)
  20.      IMGDEPTH=Peek(IMGSTRUCT+5)
  21.      Hot Spot SOURCEIMAGE,$0
  22.      Screen Open 7,IMGWIDTH,IMGHEIGHT,2^IMGDEPTH,Lowres
  23.      Curs Off : Cls 0
  24.  
  25.      Paste Bob 0,0,SOURCEIMAGE
  26.      Get Bob DESTIMAGE,0,0 To IMGWIDTH,IMGHEIGHT
  27.      
  28.      Screen Close 7
  29.      Screen CURRENTSCREEN
  30.    End Proc
  31.  
  32.    NOTE: This routine will set the image-handles to 0,0 
  33.  
  34.  
  35.    This requires 1 Vbl to clone a 64w X 64h 64-colour bob on my
  36.    14MHz machine (probably not much faster on any CPU due to the
  37.    heavy reliance on the blitter), so whether it's fast enough to be
  38.    useful or not, only you can decide... ;-)
  39.  
  40.  
  41.                 Garfield Benjamin    e-mail:gbenjam@sosbbs.com
  42.          Website( http://www.sosbbs.com/~gbenjam ): 50% Complete
  43.  
  44.